package com.self.baseutile.components;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.self.baseutile.MRWApplication;
import com.self.baseutile.R;
import com.self.baseutile.Utile.ImageLoaderUtil;

/**
 * Craeted by: huangdx
 * Date : 2021/2/22
 * Describe :
 */
public class LoadingDialog extends Dialog {

    public LoadingDialog(Context context) {
        super(context, R.style.CustomDialog);
    }
    @Override
    public void show() {
        super.show();
        Window window = this.getWindow();
        WindowManager.LayoutParams p = window.getAttributes(); // 获取对话框当前的参数值
        this.setCanceledOnTouchOutside(false);
        window.setAttributes(p);
        this.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                if (i == KeyEvent.KEYCODE_BACK) {
                    dialogInterface.dismiss();
                }
                return false;
            }
        });
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setCancelable(false);
        setContentView(R.layout.progress_dialog);
    }
}
